import 'package:base_plugin/base_plugin.dart';
import 'package:finance_app/src/common/app_colors.dart';
import 'package:finance_app/src/widgets/common/tag_widget.dart';
import 'package:finance_app/src/widgets/wrapper/normal_form_wrapper.dart';
import 'package:flutter/material.dart';

class LeaverItem extends StatelessWidget {
  final String name;
  final String title;
  final String status;
  final String timeRange;
  final num day;

  const LeaverItem(
      {Key key, this.name, this.title, this.status, this.timeRange, this.day})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      height: getDp(121),
      child: NormalFormWrapper(
        leftPadding: getDp(35),
        rightPadding: getDp(35),
        topPadding: getDp(27),
        bottomPadding: getDp(23),
        hasBottomBorder: true,
        child: Stack(
          clipBehavior: Clip.none,
          children: [
            Positioned(
              top: 0,
              bottom: 0,
              left: 0,
              child: Column(
                mainAxisSize: MainAxisSize.min,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text(
                    name,
                    style: TextStyle(
                      color: aceBlackColor,
                      fontSize: getSp(18),
                      fontWeight: FontWeight.w700,
                      height: 14 / 18,
                    ),
                  ),
                  SizedBox(
                    height: getDp(8),
                  ),
                  Text(
                    title,
                    style: TextStyle(
                      color: aceBlueColor,
                      fontSize: getSp(16),
                      fontWeight: FontWeight.w700,
                      height: 16 / 14,
                    ),
                  ),
                  SizedBox(
                    height: getDp(8),
                  ),
                  Text(
                    timeRange,
                    style: TextStyle(
                      color: aceDarkGrayColor,
                      fontSize: getSp(16),
                      fontWeight: FontWeight.w400,
                      height: 16 / 14,
                    ),
                  ),
                ],
              ),
            ),
            Positioned(
              top: 0,
              bottom: 0,
              right: 0,
              child: Column(
                mainAxisSize: MainAxisSize.min,
                crossAxisAlignment: CrossAxisAlignment.end,
                children: [
                  if (status != null)
                    status == 'Rejected' || status == 'Withdraw'
                        ? NormalRedTagWidget(
                            content: status,
                          )
                        : (status == 'closed' || status == 'Upcoming'
                            ? BlueTagWidget(
                                content: status,
                              )
                            : RedTagWidget(
                                content: status,
                              )),
                  SizedBox(
                    height: getDp(9),
                  ),
                  Text(
                    '$day ${day > 1 ? 'days' : 'Day'}',
                    style: TextStyle(
                      color: aceBlackColor,
                      fontSize: getSp(16),
                      fontWeight: FontWeight.w700,
                      height: 14 / 16,
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
